import express from "express";
import tokenMiddleware from "../middleware/token.middleware";
import validate from '../middleware/validator.middleware';
import controller from '../controllers/group.controller';
import GroupSchemas from '../schemas/group.schemas';

const router = express.Router();
router.use(tokenMiddleware);

router.get('/',
    validate(GroupSchemas.groupIdQuery),
    controller.getGroup
);

router.post('/',
    validate(GroupSchemas.createGroup),
    controller.createGroup
);

router.post('/member',
    validate(GroupSchemas.inviteFriend),
    controller.inviteFriend
);

router.delete('/',
    validate(GroupSchemas.groupIdQuery),
    controller.disbandGroup
);

router.delete('/',
    validate(GroupSchemas.removeMember),
    controller.removeMember
);

router.put('/',
    validate(GroupSchemas.updateGroup),
    controller.updateGroup
);

export default router;